<%@ page contentType="text/html; charset=UTF-8"%>
<%@ include file="/commons/taglibs.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title></title>
</head>
<link href="${ctx}/css/main/base.css" rel="stylesheet" type="text/css"/>
<link href="${ctx}/css/main/main.css" rel="stylesheet" type="text/css"/>

<body class="m_6" style="over">
<div id="main">
	<div class="zdsz" id="select1">
		<div class="tab"><h3 onclick="f1();">管理角色</h3><h3 onclick="f2();">新建角色</h3><h3 class="sel" onclick="f3();">调整角色序号高低</h3><h3 onclick="f4();">添加／删除权限</h3></div>
		<div class="zd_gut">
		<ul class="block">
		<li>
				<table width="70%" border="0" align="center" cellpadding="0" cellspacing="0" class="tab_1">
				  <tr>
					<td class="w1 bg4 center">角色</td>
					<td class="w1 bg4 center">排序</td>
				  </tr>
				  <tr>
					<td class="bg2">
					<select id="roles" size="20" style="width: 260px">
					 <s:iterator value="roles" status="role">
						<option value="${roleId}">${roleName}</option>
					</s:iterator>
					</select>
					 </td>
					<td align="center"><img src="${ctx}/images/main/m_up.gif" onclick="moveUp();"/><br/><br/><img src="${ctx}/images/main/m_down.gif" onclick="moveDown();"/></td>
				  </tr>
		  		</table>
		</li>
		</ul>
		<div class="bihe"></div>
		</div>
	</div>
</div>
</body>
</html>
<script type="text/javascript">
<!--
	
	function f1(){
		window.location = "${ctx}/role/role!index.action";
	}
	function f2(){
		window.location = "${ctx}/role/role!preCreate.action";
	}
	function f3(){
		window.location = "${ctx}/role/role!preModifyOrder.action";
	}
	function f4(){
		window.location = "${ctx}/role/role!preManagePermission.action";
	}
	
	function moveUp(){
		var selectRole = document.getElementById("roles");
		for(var i=0;i<selectRole.options.length;i++){
			if(selectRole.options[i].selected && i != 0){
				var temp = new Option(selectRole.options[i].text,selectRole.options[i].value);
				var temp2 = new Option(selectRole.options[i-1].text,selectRole.options[i-1].value);
				selectRole.options[i] =temp2;
				selectRole.options[i-1] =temp;
			}
		}
	
	}
	
	function moveDown(){
		var selectRole = document.getElementById("roles");
		for(var i=0;i<selectRole.options.length;i++){
			if(selectRole.options[i].selected && i != selectRole.options.length-1){
				var temp = new Option(selectRole.options[i].text,selectRole.options[i].value);
				var temp2 = new Option(selectRole.options[i+1].text,selectRole.options[i+1].value);
				selectRole.options[i] =temp2;
				selectRole.options[i+1] =temp;
			}
		}
	}
//-->
</script>